$(function(){
    let url=window.location.href
    console.log(qr)
    $.ajax({
       url:"http://chst.vip:1234/api/getcategorybyid",
       type:"get",
       data:{
        categoryid:qr.categoryid
       },
       success(res){
        let href=""
        let DL=""
        let {result}=res;
        result.forEach((item,index,array)=>{
            DL+=item.category+">"
            href+=`bijia.html?title=${item.category}&categoryid=${item.categoryId}`
        })
        $(".a1").html(DL)
        $(".a1").attr("href",href)
       },
       error(err){
           console.log(err)
       }
    })
    $.ajax({
       url:"http://chst.vip:1234/api/getproduct",
       type:"get",
       data:{
        productid:qr.productid
       },
       success(res){
        let {result}=res;
        console.log(res)
        let html=""
        result.forEach((item,index,array)=>{
            $(".a2").html(item.productName)
            html+=`
            <div class="picture">
             <div class="img">
                ${item.productImg}
            </div>
            <div class="title">${item.productName}</div>
           </div>
            <div class="row">
                   <div class="col1">当前最低￥6000</div> 
                   <div class="col2">优选评论8266条</div> 
            </div>
            
            <div class="avalute">${item.bjShop}</div>
            `
        })
        $("main").html(html)
       },
       error(err){
           console.log(err)
       }
    }).then(res=>{
        $.ajax({
        url:"http://chst.vip:1234/api/getproductcom",
       type:"get",
       data:{
        productid:qr.productid
       },
       success(res){
        let {result}=res;
        console.log(res)
        let discount=""
        result.forEach((item,index,array)=>{
            discount+=`
            <div class="box">
                <div class="upfix">
                    <span>${item.comName}<span>
                    <span>${item.comTime}<span>
                </div>
                <div class="content-in">${item.comContent}</div>
                <div class="content-bottom">${item.comFrom}</div>
            </div>
            `
        })
        $(".content").html(discount)
       },
       error(err){
           console.log(err)
       }
    })
})
})